package com.example.tagsdemo.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.example.tagsdemo.converter.GenderConverter;
import lombok.Data;

import javax.persistence.*;
import java.util.List;

@Entity
@Table(name = "student")
@Data
public class Student extends BaseData{

    private static final long serialVersionUID = -5103936306962248929L;

    @ExcelProperty("姓名")
    private String name;

    @ExcelProperty("年龄")
    private Integer age;

//    @ExcelProperty(value = "年龄",converter = GenderConverter.class)
    @ExcelProperty(value = "性别")
    private Integer gender;

    @ExcelProperty(value = "邮箱")
    private String email;

    @ExcelIgnore
    @OneToOne(cascade=CascadeType.ALL)
    @JoinColumn(name="class_id",referencedColumnName="id")
    private Classes classes;

    @ExcelIgnore
    @OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
    @JoinColumn(name = "student_id")
    private List<StudentCourse> scoreList;

}
